﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EZXPNS
{
    class Payment
    {
        private decimal _credit;
        private decimal _debit;
        private decimal _cash;
        private decimal _ezlink;
        private decimal _others;

        public Payment()
        {
            _credit = 0m;
            _debit = 0m;
            _cash = 0m;
            _ezlink = 0m;
            _others = 0m;
        }

        public Payment(decimal credit, decimal debit, decimal cash, decimal ezlink, decimal others)
        {
            _credit = credit;
            _debit = debit;
            _cash = cash;
            _ezlink = ezlink;
            _others = others;
        }

        public decimal Credit
        {
            get { return _credit; }
            set { _credit = value; }
        }

        public decimal Debit
        {
            get { return _debit; }
            set { _debit = value; }
        }

        public decimal Cash
        {
            get { return _cash; }
            set { _cash = value; }
        }

        public decimal Ezlink
        {
            get { return _ezlink; }
            set { _ezlink = value; }
        }

        public decimal Others
        {
            get { return _others; }
            set { _others = value; }
        }

        //Transferring an amount from one account to another (all account names are input in capital letters: CREDIT, DEBIT, CASH, EZLINK, OTHERS)
        public void transfer(string from, string to, decimal amount)
        {
            switch (from)
            {
                case "CREDIT":
                    Credit -= amount;
                    break;
                case "DEBIT":
                    Debit -= amount;
                    break;
                case "CASH":
                    Cash -= amount;
                    break;
                case "EZLINK":
                    Ezlink -= amount;
                    break;
                case "OTHERS":
                    Others -= amount;
                    break;
            }

            switch (to)
            {
                case "CREDIT":                  
                    Credit += amount;
                    break;
                case "DEBIT":
                    Debit += amount;
                    break;
                case "CASH":
                    Cash += amount;
                    break;
                case "EZLINK":
                    Ezlink += amount;
                    break;
                case "OTHERS":
                    Others += amount;
                    break;
            }
        }
    }
}
